﻿var football = require('./football_shua.js')
var querystring = require('querystring');

exports.index = function(req, res){
	res.render('index');
};

exports.about = function(req, res){
	res.render('about');
};

exports.yijian = function(req, res){
    req.on('data', function(data){
	    var obj = querystring.parse(data.toString());
		//res.send(obj.uid + obj.chaojibi);
		//res.send(obj.chaojibi);
		football.shua(obj.uid, '7', '2', '0', obj.chaojibi);
		football.shua(obj.uid, '1', '7', '0', obj.zijin);
		football.shua(obj.uid, '1', '2', '0', obj.jingyan);
		football.shua(obj.uid, '2', '11', '3000', obj.jingti);
		football.shua(obj.uid, '2', '11', '2114', obj.xunzhang);
	});
	res.render('return');
};

exports.duifu = function(req, res){
    req.on('data', function(data){
	    var obj = querystring.parse(data.toString());
		football.xunhuan(obj.uid, '1', 100, 121);
		football.xunhuan(obj.uid, '2', 200, 221);
		football.shua(obj.uid, '2', '11', '3000', obj.jingti);
	});
	res.render('return');
};

exports.qiuyuan = function(req, res){
	req.on('data', function(data){
	    var obj = querystring.parse(data.toString());
		football.qiuyuan(obj.uid, obj.id);
	});
	res.render('return');
};

exports.shengxing = function(req, res){
	req.on('data', function(data){
	    var obj = querystring.parse(data.toString());
		football.qiuyuans(obj.uid, obj.id);
		football.shua(obj.uid, '2', '11', '2114', obj.xunzhang);
	});
	res.render('return');
};